<?php
namespace Admin\Controller;
use Think\Controller;
class ListerController extends BaseController{
	function lister(){
		$ectryOb=D('Wares_entry');
		$arr=$ectryOb->join('wares_type ON wares_type.id=wares_entry.wares_typeid')->select();
		
		$this->assign('arr',$arr);
		$this->display();
	}
	function list_del(){
		
		$ectryOb=D('Wares_entry');
		$arr=$ectryOb->where("wares_id = {$_GET['wares_id']}")->delete();
		if ($arr) {
			echo 1;
		}else{
			echo 0;
		}
	}
	function list_upd(){
		$id = $_GET['id'];
		$ectryOb=D('Wares_entry');
		if ($_GET['state']==0) {
			$arr = array('state'=>1);
			$re=$ectryOb->where("wares_id=$id")->data($arr)->save();
		}else{
			$arr = array('state'=>0);
			$re = $ectryOb->where("wares_id = $id")->data($arr)->save();
		}
		if($re){
			echo 1;
		}
	}
} 